//
//  allActivityViewController.m
//  YuErmuYing
//
//  Created by Tiancheng on 16/9/14.
//  Copyright © 2016年 Tiancheng. All rights reserved.
//

#import "allActivityViewController.h"
#import "HttpRequest.h"
//#import "UIParameter.h"
#import "Macros.h"
//#import "allActivieTableViewCell.h"
#import "allActiveView.h"
#import "allActivity.h"
#import "UIImageView+WebCache.h"
#import "nextXianXiaHuoDongViewController.h"
#import "allActivity.h"
#import "swimToPhoto.h"
#import "babySwimViewController.h"
#import "xianXiaDetailViewController.h"

#import "SVProgressHUD.h"

@interface allActivityViewController ()<UIScrollViewDelegate>
@property(nonatomic,copy)NSMutableArray *tableViewArray;
//@property(nonatomic,retain)UITableView *myTableView;
//@property(nonatomic,retain)allActivieTableViewCell *myCell;
//@property(nonatomic,retain)UILabel *nameLabel;
//@property(nonatomic,retain)UIButton *moreButton;
//@property(nonatomic,retain)UILabel *moreLabel;
//@property(nonatomic,retain)UIImageView *rightImageView;
//标题数组
@property(nonatomic,copy)NSMutableArray *indexArray;
@property(nonatomic,copy)NSDictionary *dic_data;
@property(nonatomic,retain)allActiveView *allView;
@property(nonatomic,copy)NSMutableArray *babys_Array;
@property(nonatomic,copy)NSMutableArray *edus_Array;
@property(nonatomic,copy)NSMutableArray *gravidas_Array;
@property(nonatomic,copy)NSMutableArray *manis_Array;
@property(nonatomic,copy)NSMutableArray *recoves_Array;
@property(nonatomic,copy)NSMutableArray *swims_Array;
@property(nonatomic,retain)UIScrollView *scrollView;
//字典(根据id来网里添加title值(婴儿游泳))
@property(nonatomic,copy)NSMutableDictionary *diction;
@end

@implementation allActivityViewController
@synthesize tableViewArray,dic_data,babys_Array,edus_Array,gravidas_Array,manis_Array,recoves_Array,swims_Array,scrollView,diction;
static float progress = 0.0f;
- (void)viewDidLoad
{
    [super viewDidLoad];
    self.indexArray=[NSMutableArray arrayWithObjects:@"婴儿游泳",@"宝贝照",@"孕妇照",@"早教",@"产后推拿",@"小儿推拿",nil];
    babys_Array=[NSMutableArray array];
    edus_Array=[NSMutableArray array];
    gravidas_Array=[NSMutableArray array];
    manis_Array=[NSMutableArray array];
    recoves_Array=[NSMutableArray array];
    swims_Array=[NSMutableArray array];
    diction=[NSMutableDictionary dictionary];
    progress=0.0f;
    [SVProgressHUD showWithStatus:@"加载中请稍后..."];
    [self getDataFromNet];
}

//从服务器获取数据
-(void)getDataFromNet
{
    NSString*urlString=[NSString stringWithFormat:@"http://112.74.114.1/Parenting/index.php/api/lineAction/actionlist"];
    HttpRequest *httpRequest=[HttpRequest sharedInstance];
    [httpRequest postWithURLString:urlString parameters:nil success:^(id responseObject)
     {
         id json = [NSJSONSerialization JSONObjectWithData:responseObject options:0 error:nil];
         dic_data=[json objectForKey:@"data"];
         babys_Array=[dic_data objectForKey:@"babys"];
         edus_Array=[dic_data objectForKey:@"edus"];
         gravidas_Array=[dic_data objectForKey:@"gravidas"];
         manis_Array=[dic_data objectForKey:@"manis"];
         recoves_Array=[dic_data objectForKey:@"recoves"];
         swims_Array=[dic_data objectForKey:@"swims"];
//         NSLog(@"dic_data.count=%ld",dic_data.count);
         if (babys_Array.count>0)
         {
//             [self increaseProgress];
//             [self setNextView];
             [self dismiss];
         }
//          NSLog(@"json=%@",json);
//         NSLog(@"dic_data=%@",dic_data);

     } failure:^(NSError *error) {
         NSLog(@"error=%@",error);
     }];
}
- (void)increaseProgress
{
    progress += 0.08f;
    [SVProgressHUD showProgress:progress status:@"加载中..."];
    
    if(progress < 1.0f){
        [self performSelector:@selector(increaseProgress) withObject:nil afterDelay:0.1f];
    } else {
        [self performSelector:@selector(dismiss) withObject:nil afterDelay:0.4f];
    }
}
- (void)dismiss
{
    [SVProgressHUD dismiss];
    [self setNextView];
    NSLog(@"2131312312");
}
-(void)setNextView
{
    float allView_height=44+5+21+5+0.174*screenWidth+5+21+5;
    scrollView=[[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, screenWidth, screenHeight-64-40)];
    scrollView.backgroundColor=[UIColor whiteColor];
    [self.view addSubview:scrollView];
    //只能一个方向滑动
    scrollView.directionalLockEnabled = YES;
    //是否翻页
    scrollView.pagingEnabled = NO;
    //垂直方向的滚动指示
    scrollView.showsVerticalScrollIndicator =YES;
    //滚动指示的风格
    scrollView.indicatorStyle = UIScrollViewIndicatorStyleWhite;
    //水平方向的滚动指示
    scrollView.showsHorizontalScrollIndicator = NO;    scrollView.delegate = self;
    CGSize newSize = CGSizeMake(screenWidth, allView_height*6);
    [scrollView setContentSize:newSize];
     for(int i=0; i<dic_data.count; i++)
    {
        self.allView=[[allActiveView alloc]initWithFrame:CGRectMake(0, allView_height*i, screenWidth, allView_height)];
        [scrollView addSubview:self.allView];
        if (i==0)
        {
            self.allView.nameLabel.text=self.indexArray[0];
            [self.allView.moreButton addTarget:self action:@selector(onMoreClick0:) forControlEvents:UIControlEventTouchUpInside];
            if (babys_Array.count>0)
            {
                UITapGestureRecognizer*tap=[[UITapGestureRecognizer  alloc ] initWithTarget:self action :@selector (onTouchView01:)];
                self.allView.view01.userInteractionEnabled = YES;
                NSString *idString=[babys_Array[0] objectForKey:@"id"];
                [diction setObject:self.allView.nameLabel.text forKey:idString];
                self.allView.view01.tag=[idString intValue];
                [self.allView.view01 addGestureRecognizer:tap];
                
                self.allView.nameLabel01.text=[babys_Array[0] objectForKey:@"seller"];
                NSString *picString01=[babys_Array[0] objectForKey:@"pic"];
                NSURL* imagePath = [NSURL URLWithString:picString01];
                //给一张默认图片，先使用默认图片，当图片加载完成后再替换
                [self.allView.picImageView01 sd_setImageWithURL:imagePath placeholderImage:[UIImage imageNamed:@"banner1"]];
                self.allView.tuanLabel01.text=@"团购价";
                NSString *priceString=[babys_Array[0] objectForKey:@"tprice"];;
                self.allView.moneyLabel01.text=[NSString stringWithFormat:@"¥%@",priceString];
                if (babys_Array.count>1)
                {
                    UITapGestureRecognizer*tap=[[UITapGestureRecognizer  alloc ] initWithTarget:self action :@selector (onTouchView02:)];
                    self.allView.view02.userInteractionEnabled = YES;
                    [self.allView.view02 addGestureRecognizer:tap];
                    NSString *idString=[babys_Array[1] objectForKey:@"id"];
//                    self.allView.view02.tag=0;
                    [diction setObject:self.allView.nameLabel.text forKey:idString];

                    self.allView.view02.tag=[idString intValue];

                    self.allView.nameLabel02.text=[babys_Array[1] objectForKey:@"seller"];
                    NSString *picString02=[babys_Array[1] objectForKey:@"pic"];
                    NSURL* imagePath02= [NSURL URLWithString:picString02];
                    self.allView.tuanLabel02.text=@"团购价";
                    NSString *priceString=[babys_Array[1] objectForKey:@"tprice"];;
                    self.allView.moneyLabel02.text=[NSString stringWithFormat:@"¥%@",priceString];
                    //给一张默认图片，先使用默认图片，当图片加载完成后再替换
                    [self.allView.picImageView02 sd_setImageWithURL:imagePath02 placeholderImage:[UIImage imageNamed:@"banner1"]];
                }
                if (babys_Array.count>2)
                {
                    UITapGestureRecognizer*tap=[[UITapGestureRecognizer  alloc ] initWithTarget:self action :@selector (onTouchView03:)];
                    self.allView.view03.userInteractionEnabled = YES;
                    [self.allView.view03 addGestureRecognizer:tap];
                    NSString *idString=[babys_Array[2] objectForKey:@"id"];
                    [diction setObject:self.allView.nameLabel.text forKey:idString];
                    self.allView.view03.tag=[idString intValue];
//                    NSLog(@"self.allView.view03.tag=%ld",self.allView.view03.tag);

                    self.allView.nameLabel03.text=[babys_Array[2] objectForKey:@"seller"];
                    NSString *picString03=[babys_Array[2] objectForKey:@"pic"];
                    NSURL* imagePath03= [NSURL URLWithString:picString03];
                    //给一张默认图片，先使用默认图片，当图片加载完成后再替换
                    [self.allView.picImageView03 sd_setImageWithURL:imagePath03 placeholderImage:[UIImage imageNamed:@"banner1"]];
                    self.allView.tuanLabel03.text=@"团购价";
                    NSString *priceString=[babys_Array[2] objectForKey:@"tprice"];;
                    self.allView.moneyLabel03.text=[NSString stringWithFormat:@"¥%@",priceString];
                }
          }
        
        }
        else if (i==1)
        {
            self.allView.nameLabel.text=self.indexArray[1];
            [self.allView.moreButton addTarget:self action:@selector(onMoreClick1:) forControlEvents:UIControlEventTouchUpInside];

            if (edus_Array.count>0)
            {
                UITapGestureRecognizer*tap=[[UITapGestureRecognizer  alloc ] initWithTarget:self action :@selector (onTouchView01:)];
                self.allView.view01.userInteractionEnabled = YES;
                NSString *idString=[edus_Array[0] objectForKey:@"id"];
//                self.allView.view01.tag=1;
                [diction setObject:self.allView.nameLabel.text forKey:idString];

                self.allView.view01.tag=[idString intValue];
                [self.allView.view01 addGestureRecognizer:tap];
                
                self.allView.nameLabel01.text=[edus_Array[0] objectForKey:@"seller"];
                NSString *picString01=[edus_Array[0] objectForKey:@"pic"];
                NSURL* imagePath = [NSURL URLWithString:picString01];
                //给一张默认图片，先使用默认图片，当图片加载完成后再替换
                [self.allView.picImageView01 sd_setImageWithURL:imagePath placeholderImage:[UIImage imageNamed:@"banner1"]];
                
                self.allView.tuanLabel01.text=@"团购价";
                NSString *priceString=[edus_Array[0] objectForKey:@"tprice"];;
                self.allView.moneyLabel01.text=[NSString stringWithFormat:@"¥%@",priceString];
                if (edus_Array.count>1)
                {
                    UITapGestureRecognizer*tap=[[UITapGestureRecognizer  alloc ] initWithTarget:self action :@selector (onTouchView02:)];
                    self.allView.view02.userInteractionEnabled = YES;
                    NSString *idString=[edus_Array[1] objectForKey:@"id"];
//                    self.allView.view02.tag=1;
                    [diction setObject:self.allView.nameLabel.text forKey:idString];

                    self.allView.view02.tag=[idString intValue];
                    [self.allView.view02 addGestureRecognizer:tap];
//                    NSLog(@"self.allView.view01.tag=%ld",self.allView.view02.tag);

                    self.allView.nameLabel02.text=[edus_Array[1] objectForKey:@"seller"];
                    NSString *picString02=[edus_Array[1] objectForKey:@"pic"];
                    NSURL* imagePath02= [NSURL URLWithString:picString02];
                    //给一张默认图片，先使用默认图片，当图片加载完成后再替换
                    [self.allView.picImageView02 sd_setImageWithURL:imagePath02 placeholderImage:[UIImage imageNamed:@"banner1"]];
                    self.allView.tuanLabel02.text=@"团购价";
                    NSString *priceString=[edus_Array[1] objectForKey:@"tprice"];;
                    self.allView.moneyLabel02.text=[NSString stringWithFormat:@"¥%@",priceString];
                }
                if (edus_Array.count>2)
                {
                    UITapGestureRecognizer*tap=[[UITapGestureRecognizer  alloc ] initWithTarget:self action :@selector (onTouchView03:)];
                    self.allView.view03.userInteractionEnabled = YES;
                    NSString *idString=[edus_Array[2] objectForKey:@"id"];
                    [diction setObject:self.allView.nameLabel.text forKey:idString];

                    self.allView.view03.tag=[idString intValue];
//                    self.allView.view03.tag=1;
                    [self.allView.view03 addGestureRecognizer:tap];
//                    NSLog(@"self.allView.view03.tag=%ld",self.allView.view03.tag);

                    self.allView.nameLabel03.text=[edus_Array[2] objectForKey:@"seller"];
                    NSString *picString03=[edus_Array[2] objectForKey:@"pic"];
                    NSURL* imagePath03= [NSURL URLWithString:picString03];
                    //给一张默认图片，先使用默认图片，当图片加载完成后再替换
                    [self.allView.picImageView03 sd_setImageWithURL:imagePath03 placeholderImage:[UIImage imageNamed:@"banner1"]];
                    self.allView.tuanLabel03.text=@"团购价";
                    NSString *priceString=[edus_Array[2] objectForKey:@"tprice"];;
                    self.allView.moneyLabel03.text=[NSString stringWithFormat:@"¥%@",priceString];
                }
            }
        }
        else if (i==2)
        {

            self.allView.nameLabel.text=self.indexArray[2];
            [self.allView.moreButton addTarget:self action:@selector(onMoreClick2:) forControlEvents:UIControlEventTouchUpInside];
            if (gravidas_Array.count>0)
            {
                UITapGestureRecognizer*tap=[[UITapGestureRecognizer  alloc ] initWithTarget:self action :@selector (onTouchView01:)];
                self.allView.view01.userInteractionEnabled = YES;
                NSString *idString=[gravidas_Array[0] objectForKey:@"id"];
                self.allView.view01.tag=[idString intValue];
                [diction setObject:self.allView.nameLabel.text forKey:idString];

//                self.allView.view01.tag=2;

                [self.allView.view01 addGestureRecognizer:tap];
                
                self.allView.nameLabel01.text=[gravidas_Array[0] objectForKey:@"seller"];
                NSString *picString01=[gravidas_Array[0] objectForKey:@"pic"];
                NSURL* imagePath = [NSURL URLWithString:picString01];
                //给一张默认图片，先使用默认图片，当图片加载完成后再替换
                [self.allView.picImageView01 sd_setImageWithURL:imagePath placeholderImage:[UIImage imageNamed:@"banner1"]];
                self.allView.tuanLabel01.text=@"团购价";
                NSString *priceString=[gravidas_Array[0] objectForKey:@"tprice"];;
                self.allView.moneyLabel01.text=[NSString stringWithFormat:@"¥%@",priceString];
                if (gravidas_Array.count>1)
                {
                    UITapGestureRecognizer*tap=[[UITapGestureRecognizer  alloc ] initWithTarget:self action :@selector (onTouchView02:)];
                    self.allView.view02.userInteractionEnabled = YES;
                    NSString *idString=[gravidas_Array[1] objectForKey:@"id"];
                    self.allView.view02.tag=[idString intValue];
                    [diction setObject:self.allView.nameLabel.text forKey:idString];

//                    self.allView.view02.tag=2;
                    [self.allView.view02 addGestureRecognizer:tap];
                    
                    self.allView.nameLabel02.text=[gravidas_Array[1] objectForKey:@"seller"];
                    NSString *picString02=[gravidas_Array[1] objectForKey:@"pic"];
                    NSURL* imagePath02= [NSURL URLWithString:picString02];
                    //给一张默认图片，先使用默认图片，当图片加载完成后再替换
                    [self.allView.picImageView02 sd_setImageWithURL:imagePath02 placeholderImage:[UIImage imageNamed:@"banner1"]];
                    self.allView.tuanLabel02.text=@"团购价";
                    NSString *priceString=[gravidas_Array[1] objectForKey:@"tprice"];;
                    self.allView.moneyLabel02.text=[NSString stringWithFormat:@"¥%@",priceString];
                }
                if (gravidas_Array.count>2)
                {
                    UITapGestureRecognizer*tap=[[UITapGestureRecognizer  alloc ] initWithTarget:self action :@selector (onTouchView03:)];
                    self.allView.view03.userInteractionEnabled = YES;
                    NSString *idString=[gravidas_Array[2] objectForKey:@"id"];
                    [diction setObject:self.allView.nameLabel.text forKey:idString];

                    self.allView.view03.tag=[idString intValue];
//                    self.allView.view03.tag=2;
                    [self.allView.view03 addGestureRecognizer:tap];
                    
                    self.allView.nameLabel03.text=[gravidas_Array[2] objectForKey:@"seller"];
                    NSString *picString03=[gravidas_Array[2] objectForKey:@"pic"];
                    NSURL* imagePath03= [NSURL URLWithString:picString03];
                    //给一张默认图片，先使用默认图片，当图片加载完成后再替换
                    [self.allView.picImageView03 sd_setImageWithURL:imagePath03 placeholderImage:[UIImage imageNamed:@"banner1"]];
                    self.allView.tuanLabel03.text=@"团购价";
                    NSString *priceString=[gravidas_Array[2] objectForKey:@"tprice"];;
                    self.allView.moneyLabel03.text=[NSString stringWithFormat:@"¥%@",priceString];
                }
            }
        }
        else if (i==3)
        {
//            self.allView.tag=3;
            self.allView.nameLabel.text=self.indexArray[3];
            [self.allView.moreButton addTarget:self action:@selector(onMoreClick3:) forControlEvents:UIControlEventTouchUpInside];
            if (manis_Array.count>0)
            {
                UITapGestureRecognizer*tap=[[UITapGestureRecognizer  alloc ] initWithTarget:self action :@selector (onTouchView01:)];
                self.allView.view01.userInteractionEnabled = YES;
                NSString *idString=[manis_Array[0] objectForKey:@"id"];
                self.allView.view01.tag=[idString intValue];
                [diction setObject:self.allView.nameLabel.text forKey:idString];

                [self.allView.view01 addGestureRecognizer:tap];
                
                self.allView.nameLabel01.text=[manis_Array[0] objectForKey:@"seller"];
                NSString *picString01=[manis_Array[0] objectForKey:@"pic"];
                NSURL* imagePath = [NSURL URLWithString:picString01];
                //给一张默认图片，先使用默认图片，当图片加载完成后再替换
                [self.allView.picImageView01 sd_setImageWithURL:imagePath placeholderImage:[UIImage imageNamed:@"banner1"]];
                self.allView.tuanLabel01.text=@"团购价";
                NSString *priceString=[manis_Array[0] objectForKey:@"tprice"];;
                self.allView.moneyLabel01.text=[NSString stringWithFormat:@"¥%@",priceString];
                if (manis_Array.count>1)
                {
                    UITapGestureRecognizer*tap=[[UITapGestureRecognizer  alloc ] initWithTarget:self action :@selector (onTouchView02:)];
                    self.allView.view02.userInteractionEnabled = YES;
                    NSString *idString=[manis_Array[1] objectForKey:@"id"];
                    self.allView.view02.tag=[idString intValue];
                    [diction setObject:self.allView.nameLabel.text forKey:idString];

                    [self.allView.view02 addGestureRecognizer:tap];
                    
                    self.allView.nameLabel02.text=[manis_Array[1] objectForKey:@"seller"];
                    NSString *picString02=[manis_Array[1] objectForKey:@"pic"];
                    NSURL* imagePath02= [NSURL URLWithString:picString02];
                    //给一张默认图片，先使用默认图片，当图片加载完成后再替换
                    [self.allView.picImageView02 sd_setImageWithURL:imagePath02 placeholderImage:[UIImage imageNamed:@"banner1"]];
                    self.allView.tuanLabel02.text=@"团购价";
                    NSString *priceString=[manis_Array[1] objectForKey:@"tprice"];;
                    self.allView.moneyLabel02.text=[NSString stringWithFormat:@"¥%@",priceString];
                }
                if (manis_Array.count>2)
                {
                    UITapGestureRecognizer*tap=[[UITapGestureRecognizer  alloc ] initWithTarget:self action :@selector (onTouchView03:)];
                    self.allView.view03.userInteractionEnabled = YES;
                    NSString *idString=[manis_Array[2] objectForKey:@"id"];
                    self.allView.view03.tag=[idString intValue];
                    [diction setObject:self.allView.nameLabel.text forKey:idString];

                    [self.allView.view03 addGestureRecognizer:tap];
                    
                    self.allView.nameLabel03.text=[manis_Array[2] objectForKey:@"seller"];
                    NSString *picString03=[manis_Array[2] objectForKey:@"pic"];
                    NSURL* imagePath03= [NSURL URLWithString:picString03];
                    //给一张默认图片，先使用默认图片，当图片加载完成后再替换
                    [self.allView.picImageView03 sd_setImageWithURL:imagePath03 placeholderImage:[UIImage imageNamed:@"banner1"]];
                    self.allView.tuanLabel03.text=@"团购价";
                    NSString *priceString=[manis_Array[2] objectForKey:@"tprice"];;
                    self.allView.moneyLabel03.text=[NSString stringWithFormat:@"¥%@",priceString];
                }
            }
        }
        else if (i==4)
        {
//            self.allView.tag=4;
            self.allView.nameLabel.text=self.indexArray[4];
            [self.allView.moreButton addTarget:self action:@selector(onMoreClick4:) forControlEvents:UIControlEventTouchUpInside];
            if (recoves_Array.count>0)
            {
                UITapGestureRecognizer*tap=[[UITapGestureRecognizer  alloc ] initWithTarget:self action :@selector (onTouchView01:)];
                self.allView.view01.userInteractionEnabled = YES;
                NSString *idString=[recoves_Array[0] objectForKey:@"id"];
                self.allView.view01.tag=[idString intValue];
                [diction setObject:self.allView.nameLabel.text forKey:idString];

                [self.allView.view01 addGestureRecognizer:tap];
                
                self.allView.nameLabel01.text=[recoves_Array[0] objectForKey:@"seller"];
                NSString *picString01=[recoves_Array[0] objectForKey:@"pic"];
                NSURL* imagePath = [NSURL URLWithString:picString01];
                //给一张默认图片，先使用默认图片，当图片加载完成后再替换
                [self.allView.picImageView01 sd_setImageWithURL:imagePath placeholderImage:[UIImage imageNamed:@"banner1"]];
                self.allView.tuanLabel01.text=@"团购价";
                NSString *priceString=[recoves_Array[0] objectForKey:@"tprice"];;
                self.allView.moneyLabel01.text=[NSString stringWithFormat:@"¥%@",priceString];
                if (recoves_Array.count>1)
                {
                    UITapGestureRecognizer*tap=[[UITapGestureRecognizer  alloc ] initWithTarget:self action :@selector (onTouchView02:)];
                    self.allView.view02.userInteractionEnabled = YES;
                    NSString *idString=[recoves_Array[1] objectForKey:@"id"];
                    self.allView.view02.tag=[idString intValue];
                    [diction setObject:self.allView.nameLabel.text forKey:idString];

                    [self.allView.view02 addGestureRecognizer:tap];
                    
                    self.allView.nameLabel02.text=[recoves_Array[1] objectForKey:@"seller"];
                    NSString *picString02=[recoves_Array[1] objectForKey:@"pic"];
                    NSURL* imagePath02= [NSURL URLWithString:picString02];
                    //给一张默认图片，先使用默认图片，当图片加载完成后再替换
                    [self.allView.picImageView02 sd_setImageWithURL:imagePath02 placeholderImage:[UIImage imageNamed:@"banner1"]];
                    self.allView.tuanLabel02.text=@"团购价";
                    NSString *priceString=[recoves_Array[1] objectForKey:@"tprice"];;
                    self.allView.moneyLabel02.text=[NSString stringWithFormat:@"¥%@",priceString];
                }
                if (recoves_Array.count>2)
                {
                    UITapGestureRecognizer*tap=[[UITapGestureRecognizer  alloc ] initWithTarget:self action :@selector (onTouchView03:)];
                    self.allView.view03.userInteractionEnabled = YES;
                    NSString *idString=[recoves_Array[2] objectForKey:@"id"];
                    self.allView.view03.tag=[idString intValue];
                    [diction setObject:self.allView.nameLabel.text forKey:idString];

                    [self.allView.view03 addGestureRecognizer:tap];
                    
                    self.allView.nameLabel03.text=[recoves_Array[2] objectForKey:@"seller"];
                    NSString *picString03=[recoves_Array[2] objectForKey:@"pic"];
                    NSURL* imagePath03= [NSURL URLWithString:picString03];
                    //给一张默认图片，先使用默认图片，当图片加载完成后再替换
                    [self.allView.picImageView03 sd_setImageWithURL:imagePath03 placeholderImage:[UIImage imageNamed:@"banner1"]];
                    self.allView.tuanLabel03.text=@"团购价";
                    NSString *priceString=[recoves_Array[2] objectForKey:@"tprice"];;
                    self.allView.moneyLabel03.text=[NSString stringWithFormat:@"¥%@",priceString];
                }
            }
        }
        else if (i==5)
        {
//            self.allView.tag=5;
            self.allView.nameLabel.text=self.indexArray[5];
            [self.allView.moreButton addTarget:self action:@selector(onMoreClick5:) forControlEvents:UIControlEventTouchUpInside];
            if (swims_Array.count>0)
            {
                UITapGestureRecognizer*tap=[[UITapGestureRecognizer  alloc ] initWithTarget:self action :@selector (onTouchView01:)];
                self.allView.view01.userInteractionEnabled = YES;
                NSString *idString=[swims_Array[0] objectForKey:@"id"];
                self.allView.view01.tag=[idString intValue];
                [diction setObject:self.allView.nameLabel.text forKey:idString];

                [self.allView.view01 addGestureRecognizer:tap];
                
                self.allView.nameLabel01.text=[swims_Array[0] objectForKey:@"seller"];
                NSString *picString01=[swims_Array[0] objectForKey:@"pic"];
                NSURL* imagePath = [NSURL URLWithString:picString01];
                //给一张默认图片，先使用默认图片，当图片加载完成后再替换
                [self.allView.picImageView01 sd_setImageWithURL:imagePath placeholderImage:[UIImage imageNamed:@"banner1"]];
                self.allView.tuanLabel01.text=@"团购价";
                NSString *priceString=[swims_Array[0] objectForKey:@"tprice"];;
                self.allView.moneyLabel01.text=[NSString stringWithFormat:@"¥%@",priceString];
                if (swims_Array.count>1)
                {
                    UITapGestureRecognizer*tap=[[UITapGestureRecognizer  alloc ] initWithTarget:self action :@selector (onTouchView02:)];
                    self.allView.view02.userInteractionEnabled = YES;
                    NSString *idString=[swims_Array[1] objectForKey:@"id"];
                    self.allView.view02.tag=[idString intValue];
                    [diction setObject:self.allView.nameLabel.text forKey:idString];

                    [self.allView.view02 addGestureRecognizer:tap];
                    
                    self.allView.nameLabel02.text=[swims_Array[1] objectForKey:@"seller"];
                    NSString *picString02=[swims_Array[1] objectForKey:@"pic"];
                    NSURL* imagePath02= [NSURL URLWithString:picString02];
                    //给一张默认图片，先使用默认图片，当图片加载完成后再替换
                    [self.allView.picImageView02 sd_setImageWithURL:imagePath02 placeholderImage:[UIImage imageNamed:@"banner1"]];
                    self.allView.tuanLabel02.text=@"团购价";
                    NSString *priceString=[swims_Array[1] objectForKey:@"tprice"];;
                    self.allView.moneyLabel02.text=[NSString stringWithFormat:@"¥%@",priceString];
                }
                if (swims_Array.count>2)
                {
                    UITapGestureRecognizer*tap=[[UITapGestureRecognizer  alloc ] initWithTarget:self action :@selector (onTouchView03:)];
                    self.allView.view03.userInteractionEnabled = YES;
                    NSString *idString=[swims_Array[2] objectForKey:@"id"];
                    [diction setObject:self.allView.nameLabel.text forKey:idString];

                    self.allView.view03.tag=[idString intValue];
                    [self.allView.view03 addGestureRecognizer:tap];
                    
                    self.allView.nameLabel03.text=[swims_Array[2] objectForKey:@"seller"];
                    NSString *picString03=[swims_Array[2] objectForKey:@"pic"];
                    NSURL* imagePath03= [NSURL URLWithString:picString03];
                    //给一张默认图片，先使用默认图片，当图片加载完成后再替换
                    [self.allView.picImageView03 sd_setImageWithURL:imagePath03 placeholderImage:[UIImage imageNamed:@"banner1"]];
                    self.allView.tuanLabel03.text=@"团购价";
                    NSString *priceString=[swims_Array[2] objectForKey:@"tprice"];;
                    self.allView.moneyLabel03.text=[NSString stringWithFormat:@"¥%@",priceString];
                }
            }
        }
  }
}
-(void)onMoreClick0:(UIButton *)sender
{
    allActivity *aa=[allActivity shardeManager];
    aa.addressString=@"http://112.74.114.1/Parenting/index.php/api/lineAction/swim";
    aa.titleString=self.indexArray[0];
    if (aa.titleString)
    {
        nextXianXiaHuoDongViewController *nxxhd=[nextXianXiaHuoDongViewController new];
        [self.navigationController pushViewController:nxxhd animated:YES];
    }
}
-(void)onMoreClick1:(UIButton *)sender
{
    allActivity *aa=[allActivity shardeManager];
    aa.addressString=@"http://112.74.114.1/Parenting/index.php/api/lineAction/baby";
    aa.titleString=self.indexArray[1];
    if (aa.titleString)
    {
        nextXianXiaHuoDongViewController *nxxhd=[nextXianXiaHuoDongViewController new];
        [self.navigationController pushViewController:nxxhd animated:YES];
    }
}
-(void)onMoreClick2:(UIButton *)sender
{
    allActivity *aa=[allActivity shardeManager];
    aa.addressString=@"http://112.74.114.1/Parenting/index.php/api/lineAction/gravida";
    aa.titleString=self.indexArray[2];
    if (aa.titleString)
    {
        nextXianXiaHuoDongViewController *nxxhd=[nextXianXiaHuoDongViewController new];
        [self.navigationController pushViewController:nxxhd animated:YES];
    }
}
-(void)onMoreClick3:(UIButton *)sender
{
    allActivity *aa=[allActivity shardeManager];
    aa.addressString=@"http://112.74.114.1/Parenting/index.php/api/lineAction/edu";
    aa.titleString=self.indexArray[3];
    if (aa.titleString)
    {
        nextXianXiaHuoDongViewController *nxxhd=[nextXianXiaHuoDongViewController new];
        [self.navigationController pushViewController:nxxhd animated:YES];
    }
}
-(void)onMoreClick4:(UIButton *)sender
{
    allActivity *aa=[allActivity shardeManager];
    aa.addressString=@"http://112.74.114.1/Parenting/index.php/api/lineAction/recove";
    aa.titleString=self.indexArray[4];
    if (aa.titleString)
    {
        nextXianXiaHuoDongViewController *nxxhd=[nextXianXiaHuoDongViewController new];
        [self.navigationController pushViewController:nxxhd animated:YES];
    }

}
-(void)onMoreClick5:(UIButton *)sender
{
    allActivity *aa=[allActivity shardeManager];
    aa.addressString=@"http://112.74.114.1/Parenting/index.php/api/lineAction/mani";
    aa.titleString=self.indexArray[5];
    if (aa.titleString)
    {
        nextXianXiaHuoDongViewController *nxxhd=[nextXianXiaHuoDongViewController new];
        [self.navigationController pushViewController:nxxhd animated:YES];
    }
}
-(void)onTouchView01:(UITapGestureRecognizer *)sender
{
    int idNum=(int)sender.view.tag;
    NSString *idString=[NSString stringWithFormat:@"%d",idNum];
//    NSLog(@"idString11=%@",idString);
    allActivity *aa=[allActivity shardeManager];
    aa.idString=idString;
    aa.titleString=[diction objectForKey:idString];
//    NSLog(@"aa.titleString=%@",aa.titleString);
    xianXiaDetailViewController *xxdv=[xianXiaDetailViewController new];
    [self.navigationController pushViewController:xxdv animated:YES];
  
    

}
-(void)onTouchView02:(UITapGestureRecognizer *)sender
{
    int idNum=(int)sender.view.tag;
    NSString *idString=[NSString stringWithFormat:@"%d",idNum];
    allActivity *aa=[allActivity shardeManager];
    aa.idString=idString;
    aa.titleString=[diction objectForKey:idString];
    xianXiaDetailViewController *xxdv=[xianXiaDetailViewController new];
    [self.navigationController pushViewController:xxdv animated:YES];
    
}
-(void)onTouchView03:(UITapGestureRecognizer *)sender
{
    int idNum=(int)sender.view.tag;
    NSString *idString=[NSString stringWithFormat:@"%d",idNum];
    allActivity *aa=[allActivity shardeManager];
    aa.idString=idString;
    aa.titleString=[diction objectForKey:idString];
//    aa.idString=self.indexArray[idNum];
    xianXiaDetailViewController *xxdv=[xianXiaDetailViewController new];
    [self.navigationController pushViewController:xxdv animated:YES];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

//-(void)viewWillDisappear:(BOOL)animated
//{
//    [SVProgressHUD dismiss];
//}

//-(void)dealloc
//{
//    NSLog(@"131");
//    [SVProgressHUD dismiss];
//}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
